package scenario;

import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
import org.bouncycastle.operator.DefaultSignatureAlgorithmIdentifierFinder;

public class SignatureExample {
    public static void main(String[] args) {
        try {
            // 在调用算法查找器之前，确保 Bouncy Castle 提供程序已注册
            java.security.Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());

            // 现在这段代码应该可以正常工作
            AlgorithmIdentifier sigAlgId = new DefaultSignatureAlgorithmIdentifierFinder().find("SHA256WithRSAEncryption");
            System.out.println("Algorithm OID: " + sigAlgId.getAlgorithm());
            System.out.println("Algorithm parameters: " + sigAlgId.getParameters());

        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
